$(function(){
	var openWindow=window.document;
	var searchHeight=$("#divform").height();
	$("#listStandard").height($(openWindow).height()-$(openWindow).height()*0.05-searchHeight-10);
	$("#listStandard").datagrid({
					url:'/hra/getStandard',
					title:'HRA标准值列表',
					method:'get',
					pagination:true,
					singleSelect:true,
					pageList: [15,30,100,500],
					loadMsg:'加载中......',
					columns:[[
					         {field:'itemcode',title:'编码', align:'left',width:250,sortable:true},
					         {field:'itemname',title:'名称',align:'left',width:200},
					         {field:'itemrange',title:'平均值',align:'center',width:100},
					         {field:'itemunit',title:'单位',align:'center',width:150,},
					         {field:'remark',title:'备注',align:'center',width:200,formatter:function(value, row, index){
					        	 if(value==undefined){
					 				return '';
					 			}
					 			else if(value.length<13){
					 				return value;
					 			}else{
					 				return value.substr(0, 13) + '...';
					 			}
					         }}
					     ]]
				});
	$("#serbutton").click(function(){
		var params={};
		params.itemcode=$("#itemcode").val();
		params.itemname=$("#itemname").val();
		$("#listStandard").datagrid('load',params);
	});
	//绑定回车事件
	$(document).keydown(function(event){ 
		if(event.keyCode==13){
			$("#serbutton").click(); 
		}
	})
});
/**
 * 打开view页
 */
function view(id){
	window.parent.opentab('HRA平均值详情','/hra/standardview','id='+id);
}